package com.sc.nft.dao;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sc.nft.entity.SaasTaskAwardDetails;
import com.sc.nft.entity.vo.SaasTaskAwardDetailsVO;
import com.sc.nft.entity.vo.SaasUserTaskIdGainAwardVO;
import com.sc.nft.mapper.SaasTaskAwardDetailsMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 任务奖励详情表(SaasTaskAwardDetails)表Dao层
 *
 * @author 王伟成
 * @since 2024-01-11 15:08:24
 */
@Slf4j
@Repository
public class SaasTaskAwardDetailsDao extends ServiceImpl<SaasTaskAwardDetailsMapper, SaasTaskAwardDetails> {

    public List<SaasTaskAwardDetails> getByTaskAwardIdAndTaskId(Long TaskAwardId, Long taskId) {
        return this.lambdaQuery().eq(SaasTaskAwardDetails::getTaskAwardId, TaskAwardId).eq(SaasTaskAwardDetails::getSaasTaskId, taskId).list();
    }

    public List<SaasTaskAwardDetailsVO> getByTaskIdLeftEquity(Long id,Long awardId,Long collectionId) {
        return baseMapper.getByTaskIdLeftEquity(id,awardId,collectionId);
    }
    public List<SaasUserTaskIdGainAwardVO> getByUserTaskIdGainAward(Long saasTaskId, Long taskAwardId) {
        return baseMapper.getByUserTaskIdGainAward(saasTaskId,taskAwardId);
    }

    public List<SaasTaskAwardDetails> getByTaskAwardId(Long taskAwardId) {
        return this.lambdaQuery().eq(SaasTaskAwardDetails::getTaskAwardId, taskAwardId).list();
    }

    public Boolean removeByTaskId(Long taskId) {
      return   this.lambdaUpdate().eq(SaasTaskAwardDetails::getSaasTaskId, taskId).remove();
    }
}
